﻿@model S4Store.Models.AfterSaleReport.AfterSaleReportServiceAdvisorModel
@{
    ViewBag.Title = "FrontServiceIndex";
    Layout = null;
    var container = "div" + Guid.NewGuid().ToString();
}
 <div style="height:100%; overflow:auto">
@Html.Action("ReportBar", "Common", Model.BarModel)
@{
    //公式部分
    if (Model.StandardConfig == null)
    {
        <text>未对该月配置标准</text>
        return;
    }

    decimal 流失客户回归率_目标 = Model.StandardConfig.流失客户回归率目标;

    //=SUM(J5/E5)
    //流   失   客   户   重   新  回   厂   数/本    月    新   增   六   月   未   回   厂   客   户   数
    decimal 流失客户回归率_实际 = Model.GetAvgLSKHHGL_Back(Model.BarModel.Month.Year, Model.BarModel.Month.Month);

    decimal 一次修复率_目标 = Model.StandardConfig.一次修复率目标;
    decimal 一次修复率_实际 = Model.GetAvgYCXHL(Model.BarModel.Month.Year, Model.BarModel.Month.Month);

    decimal 准时交车率_目标 = Model.StandardConfig.准时交车率目标;
    decimal 准时交车率_实际 = Model.GetAvgZSJCL(Model.BarModel.Month.Year, Model.BarModel.Month.Month); 
    
    
 }

<div style="position:relative; width:100%">
    @{

        S4Store.Models.Chart.Column ChartModel = new S4Store.Models.Chart.Column();
        ChartModel.Colors = new List<string> { S4Store.Models.Chart.Color.Green, S4Store.Models.Chart.Color.Blue };
        ChartModel.IsRate = true;
        //ChartModel.Name = "登记客户";
        ChartModel.YAxis = "后台管理关键KPI";
        //ChartModel.Width = 500;
        //ChartModel.Height = 300;
        ChartModel.XAxis.Add("流失客户回归率");
        ChartModel.XAxis.Add("一次修复率");
        ChartModel.XAxis.Add("准时交车率");

        S4Store.Models.Chart.ChartSeries series1 = new S4Store.Models.Chart.ChartSeries();
        series1.Name = "目标";
        series1.Data.Add(流失客户回归率_目标);
        series1.Data.Add(一次修复率_目标);
        series1.Data.Add(准时交车率_目标);
        ChartModel.Serieses.Add(series1);


        S4Store.Models.Chart.ChartSeries series2 = new S4Store.Models.Chart.ChartSeries();
        series2.Name = "实际";
        series2.Data.Add(流失客户回归率_实际);
        series2.Data.Add(一次修复率_实际);
        series2.Data.Add(准时交车率_实际);
        //series2.Data.Add((Model.应时产值 == 0 ? 0 : Model.实际产值 / Model.应时产值)*100);
        ChartModel.Serieses.Add(series2);
    
    
        @Html.Partial("../Chart/Column", ChartModel)
        <div style=" margin-left:70px; overflow:hidden">
        <table style="width:100%">
            <tr>
                <td align="center" width="30">
                @if (流失客户回归率_实际 < 流失客户回归率_目标)
                {
                    <a class="middlered" href="@Url.Action("BackService_LSKHHGL", new { Month = Model.BarModel.Month.ToString("yyyy-MM-dd") })" target="navtab" title="流失客户回归率">
                        @(流失客户回归率_实际 - 流失客户回归率_目标)%
                    </a>
                }
                else
                {
                    <a class="middlegreen" href="@Url.Action("BackService_LSKHHGL", new { Month = Model.BarModel.Month.ToString("yyyy-MM-dd") })" target="navtab" title="流失客户回归率">
                        @(流失客户回归率_实际 - 流失客户回归率_目标)%
                    </a>
                }

                </td>
                <td align="center" width="30">
                @if (一次修复率_实际 < 一次修复率_目标)
                {
                    <a class="middlered" href="@Url.Action("BackService_YCXFL", new { Month = Model.BarModel.Month.ToString("yyyy-MM-dd") })" target="navtab" title="一次修复率">
                        @(一次修复率_实际 - 一次修复率_目标)%
                    </a>
                }
                else
                {
                    <a class="middlegreen" href="@Url.Action("BackService_YCXFL", new { Month = Model.BarModel.Month.ToString("yyyy-MM-dd") })" target="navtab" title="一次修复率">
                        @(一次修复率_实际 - 一次修复率_目标)%
                    </a>
                }

                </td>
                <td align="center" width="30">
                @if (准时交车率_实际 < 准时交车率_目标)
                {
                    <a class="middlered" href="@Url.Action("BackService_ZSJCL", new { Month = Model.BarModel.Month.ToString("yyyy-MM-dd") })" target="navtab" title="准时交车率">
                        @(准时交车率_实际 - 准时交车率_目标)%
                    </a>
                }
                else
                {
                    <a class="middlegreen" href="@Url.Action("BackService_ZSJCL", new { Month = Model.BarModel.Month.ToString("yyyy-MM-dd") })" target="navtab" title="准时交车率">
                        @(准时交车率_实际 - 准时交车率_目标)%
                    </a>
                }

                </td>
            </tr>
        </table>
        </div>
        
    }
    
</div>
</div>

